import { defineStore } from "pinia"
import { reactive, watch } from "vue"
import { Config, Entity } from "../model"
import { getData, updateConfig } from "./db"

export const useConfigStore = defineStore("config", () => {
    const config: Entity<Config> = reactive(getData().config)

    watch(config, updateConfig)

    return {
        config,
    }
})
